@include('admin.header')
<style>
    .search_product {
        max-height:248px;
        overflow-y: scroll;
    }
    .search_product > .item {
        width:80px;
        margin-right:5px;
        float:left;
    }
    .search_product > .item img {
        height:80px;
    }
    .search_product > .item .name {
        height:20px;
        overflow:hidden;
    }

    .order_info {
        display: block;
        margin-top: 5px;
    }

    .line {
        border: 3px dashed #ccc;
        margin-top: 10px;
        margin-bottom: 20px;
    }
</style>
<div class="margin-top-20">
    <form method="post" class="form-horizontal js-ajax-form direct_order_edit_form" action="/globalexchange/direct_order_edit" novalidate="novalidate" enctype ="multipart/form-data">
        <fieldset>
            @foreach($data as $val)
            <!-- 订单号 -->
            <div class="control-group"><label class="control-label">订单号</label>
                <div class="controls">
                    <span class="order_info">{{$val->order_no}}</span>
                </div>
            </div>
            <!-- 购买用户ID号 -->
            <div class="control-group"><label class="control-label">用户ID号</label>
                <div class="controls">
                    <span class="order_info">{{$val->node_id}}</span>
                </div>
            </div>
            <!-- 用户名 -->
            <div class="control-group"><label class="control-label">用户名</label>
                <div class="controls">
                    <span class="order_info">{{$nodename}}</span>
                </div>
            </div>
            <!-- 订单金额 -->
            <div class="control-group"><label class="control-label">订单金额</label>
                <div class="controls">
                    <span class="order_info">{{$val->amount}}</span>
                </div>
            </div>
            <!-- 支付金额 -->
            <div class="control-group"><label class="control-label">支付金额</label>
                <div class="controls">
                    <span class="order_info">{{$val->pay_amount}}</span>
                </div>
            </div>
            <!-- 支付时间 -->
            <div class="control-group"><label class="control-label">支付时间</label>
                <div class="controls">
                    <span class="order_info">
                        @if($val->pay_time)
                            {{$val->pay_time}}
                        @else
                            无
                        @endif
                    </span>
                </div>
            </div>

            <!-- 支付状态 -->
            <div class="control-group"><label class="control-label">支付状态</label>
                <div class="controls">
                    <span class="order_info">
                        @if($val->status == 0)
                            等待支付
                        @elseif($val->status == 1)
                            支付成功
                        @elseif($val->status == 2)
                            支付失败
                        @elseif($val->status == 3)
                            订单关闭
                        @endif
                    </span>
                </div>
            </div>
            <!-- 下单时间 -->
            <div class="control-group"><label class="control-label">下单时间</label>
                <div class="controls">
                    <span class="order_info">
                        @if($val->create_time)
                            {{$val->create_time}}
                        @else
                            无
                        @endif
                    </span>
                </div>
            </div>
            <!-- 优惠券抵扣金额 -->
            <div class="control-group"><label class="control-label">优惠券抵扣金额</label>
                <div class="controls">
                    <span class="order_info">{{$val->discount_amount}}</span>
                </div>
            </div>
            <!-- 订单PV -->
            <div class="control-group"><label class="control-label">订单PV</label>
                <div class="controls">
                    <span class="order_info">{{$val->order_pv}}</span>
                </div>
            </div>
            <!-- 分割线 -->
            <div class="line"></div>
            @endforeach
        </fieldset>
    </form>
</div>

<script>
    $(function () {
        $('.direct_order_edit_form').submit(function(){
            var $t = $(this),action=$t.attr('action'),data = $t.serialize();
            post(action,data,function(data){
                _alert('处理成功',function(){
                    parent.location.reload();
                    parent.layer.close(parent.layer_open2);
                });
            });
            return false;
        });
    });

    function product_add(product_id){
        var $t = $('[name=product_id]'),val = $t.val(),vals = val.split(',');
        product_id = product_id + '';
        if(vals.length == 1){
            if(vals[0] == '')
                vals = [];
        }
        if($.inArray(product_id,vals) === -1){
            vals.push(product_id);
            val = vals.join(',');
        }
        $t.val(val);
    }
</script>